home *** CD-ROM | disk | FTP | other *** search
Text File | 1986-07-10 | 2.5 KB | 93 lines | [TEXT/ttxt] |
- /* Written 5:26 am Jul 6, 1986 by baron@runx.OZ in uiucdcsb:net.sources.mac */
- /* ---------- "ZoomRect() - C source" ---------- */
-
- Here is the C source to zoomrect() - a function that produces the zooming
- effect found in various programs like the Finder.
-
-
- /* Jason Haines ACSnet: baron@runx
- * ElecEng Undergraduate CSNET: baron@runx.oz
- * Australia ARPA: baron%runx.oz@seismo.css.gov
- *
- * UUCP:
- * {enea,hplabs,mcvax,prlb2,seismo,ubc-vision,ukc}!munnari!runx.oz!baron
- */
-
- --------------------------(Cut Here)----------------------------
- /*
- * Title: zoomrect.c
- * Author: Jason Haines
- * Version: 1.0
- * Date: July 6th 1986
- *
- * Synopsis: The function zoomrect(sourcerect,destrect,zoomSteps) produces
- * the zoom effect found in the Finder.
- * Where:
- * sourcerect is the source rectangle;
- * destrect is the destination rectangle;
- * zoomSteps is the number of intermediate rectangles
- * displayed.
- *
- *
- * Jason Haines
- * 73 Davidson Avenue
- * Concord NSW 2137
- * AUSTRALIA
- *
- * STD: (02) 73-4444
- * ISD: +61 2 73-4444
- * ACSnet: baron@runx
- * CSNET: baron@runx.oz
- * ARPA: baron%runx.oz@seismo.css.gov
- * JANET: runx.oz!baron@ukc
- * UUCP: {enea,hplabs,mcvax,prlb2,seismo,ubc-vision,ukc}!munnari!runx.oz!baron
- */
-
- #include "qd.h"
- #include "qdvars.h"
-
- #define MaxZoom 100
-
- zoomrect(r1,r2,zoomSteps)
- rect *r1,*r2;
- int zoomSteps;
- {
- int hDiff, vDiff, widDiff, htDiff;
- int l, t, r, b;
- int rWid, rHt;
- register int i, j;
- register int zIndex;
- rect *rp;
- static rect zRect[MaxZoom];
- penstate oldpen;
-
- if (zoomSteps > MaxZoom)
- return(0);
- getpenstate(&oldpen);
- penpat(gray);
- penmode(notpatxor);
- zIndex = zoomSteps;
- hDiff = r2->a.left - r1->a.left; /* positive if moving to right */
- vDiff = r2->a.top - r1->a.top; /* positive if moving down */
- rWid = r1->a.right - r1->a.left;
- rHt = r1->a.bottom - r1->a.top;
- widDiff = (r2->a.right - r2->a.left) - rWid;
- htDiff = (r2->a.bottom - r2->a.top) - rHt;
- for ( i = 1; i < 3 ; i++)
- for ( j = 1; j < zoomSteps ; j++)
- {
- ++zIndex;
- if (zIndex >= zoomSteps)
- zIndex = 0;
- rp = &zRect + zIndex;
- l = r1->a.left + (hDiff * j) / zoomSteps;
- t = r1->a.top + (vDiff * j) / zoomSteps;
- r = l + rWid + (widDiff * j) / zoomSteps;
- b = t + rHt + (htDiff * j) / zoomSteps;
- setrect (rp, l, t, r, b);
- framerect (rp);
- }
- setpenstate(&oldpen);
- }
- /* End of text from uiucdcsb:net.sources.mac */
-